<% content_for :page_title do %>
  <%= plural_resource_name(Spree::PromotionCategory) %>
<% end %>

<% content_for :page_actions do %>
  <%= button_link_to Spree.t(:new_promotion_category), new_object_url, icon: 'add.svg', class: 'btn-success' %>
<% end if can?(:create, Spree::PromotionCategory) %>

<% if @promotion_categories.any? %>

<div class="table-responsive">
  <table class="table">
    <thead>
      <th><%= Spree::PromotionCategory.human_attribute_name :name %></th>
      <th><%= Spree::PromotionCategory.human_attribute_name :code %></th>
      <th></th>
    </thead>
    <tbody>
      <% @promotion_categories.each do |promotion_category| %>
        <tr>
          <td><%= promotion_category.name %></td>
          <td><%= promotion_category.code %></td>
          <td class="actions actions-2 text-right">
            <%= link_to_edit promotion_category, no_text: true if can?(:edit, promotion_category) %>
            <%= link_to_delete promotion_category, no_text: true if can?(:delete, promotion_category) %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>
<% else %>
  <div class="alert alert-info no-objects-found">
    <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::PromotionCategory)) %>,
    <%= link_to Spree.t(:add_one), new_object_url %>!
  </div>
<% end %>
